﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FileWatcher
{
    class DirectoryRecord
    {
        public DirectoryInfo Info { get; set; }

        public IEnumerable<FileInfo> Files
        {
            get
            {

                return Info.GetFiles();
            }
        }

        public IEnumerable<DirectoryRecord> Directories
        {
            get
            {
                try
                {
                    return from di in Info.GetDirectories("*", SearchOption.TopDirectoryOnly)
                           select new DirectoryRecord { Info = di };
                }
                catch (Exception ex)
                {
                    return null;
                }
            }
        }
    }
}
